/*
* minin全局混入，监听页面滚动
*/

let pkatform = typeof window === 'object' ? 'browser' : (uni.getSystemInfoSync().platform === 'android' ? 'android' : 'ios')

const scroll = {
	data (){
		return {
			pkatform,
			scrollOffsetTop: 0,
			tabClick: null
		}
	},
	onShow (){
		// 展示页面时，回到当前滚动条位置
		uni.pageScrollTo({
			scrollTop: this.scrollOffsetTop,
			duration: 150
		})
	},
	onPageScroll (e){
		// 记录滚动条位置
		this.scrollOffsetTop = e.scrollTop;
	}
};
export default scroll